import React, { Component } from 'react'
import "./Header.less";
import { withRouter } from 'react-router-dom'
import { LeftOutline } from 'antd-mobile-icons'

class Header extends Component {
    goBack(){
        this.props.history.go(-1)
    }
    push(path){
        this.props.history.push(path)
    }
  render() {
    let { title ,back,register} = this.props;
    return (
        <div className="header">
        {back? <span className="back"  onClick={()=>this.goBack()}>
          <LeftOutline />
        </span>:null}
         <div className="title">
           {title}
         </div>
         {register?<span className="reBtn" onClick={()=>this.push('/register')}>注册</span>:null}
       </div>
    )
  }
}

export default withRouter(Header)
